<?php echo $this->renderElement('tinymce-admin'); ?>

<script type="text/javascript">
	var ar_pattern = new Array('[àâä]', 'ß', 'ç', '[éèêë]', '[îï]', '[ùûü]', '[^a-z0-9]', '-\+');
	var ar_new_pattern = new Array('a', 'b', 'c', 'e', 'i', 'u', '-', '-')

	function sluggable(str){
		var txt_slug = document.getElementById("PageSlug");
		//str = rem
		txt_slug.value = preg_replace(str);
	}
	
	function preg_replace(str){
		var new_str = String(str);
		
		for(i=0; i < ar_pattern.length; i++){
			var reg_exp = RegExp(ar_pattern[i], "gi");
			var val_2_replace = ar_new_pattern[i];
			new_str = new_str.replace(reg_exp, val_2_replace);
		}
		
		return new_str;
	}
	
</script>
<div>
	<?php echo $form->label('Page/user_id', 'Owner');?>
	<?php echo $form->select('Page/user_id', $users, null, null, null); ?>
</div>

 	<?php echo $form->input('Page/title', array('div' => array('class' => 'required'), 'onkeyup' => 'sluggable(this.value)'));?>		
 	<a href="#" title="Edit slug" onclick="new Effect.BlindDown('divPageSlug')">[+]</a>
 	<?php echo $form->input('Page/slug', array('div' => array('id' => 'divPageSlug', 'class' => 'required', 'style' => 'display:none')));?>

<div>
	<?php echo $form->label('Page/category_id', 'Category');?>
	<?php echo $form->select('Page/category_id', $categories); ?>
</div>


	<?php echo $form->input('Page/content', array('div' => array('class' => 'required'), 'type' => 'textarea', 'cols' => '45', 'rows' => '15'));?>

	<?php echo $form->input('Page/online', array('label' => 'Online?', 'type' => 'checkbox'));?>


<?php //echo $form->hidden('Page/created'); ?>
<div class="date">
	<?php echo $form->label(null, 'Published at :'); ?>
	<?php echo $form->dateTime('Page.created', 'DMY', '24');?>
</div>
